//
//  YHBaseNavController.swift
//  WeiBoYH
//
//  Created by yanhui on 2017/1/5.
//  Copyright © 2017年 yanhui. All rights reserved.
//

import UIKit

class YHBaseNavController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()
  
    }

    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
      
        let count = self.childViewControllers.count
        if count > 0 {
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", target: self, action: #selector(close))
            
            viewController.hidesBottomBarWhenPushed = true
        }
        
        super.pushViewController(viewController, animated: animated)
    }
    
    
    @objc private func close() {
        self.popViewController(animated: true)
    }

    
  

}
